﻿using System;
using UnityEngine;

namespace SceneAssist
{
	// Token: 0x02000515 RID: 1301
	public class ContentSizeChange : MonoBehaviour
	{
		// Token: 0x06002122 RID: 8482 RVA: 0x000CB964 File Offset: 0x000C9B64
		private void OnEnable()
		{
			if (this.target == null)
			{
				return;
			}
			if (!this.width.use && !this.height.use)
			{
				return;
			}
			Vector2 sizeDelta = this.target.sizeDelta;
			if (this.width.use)
			{
				sizeDelta.x = this.width.enableSize;
			}
			if (this.height.use)
			{
				sizeDelta.y = this.height.enableSize;
			}
			this.target.sizeDelta = sizeDelta;
		}

		// Token: 0x06002123 RID: 8483 RVA: 0x000CBA00 File Offset: 0x000C9C00
		private void OnDisable()
		{
			if (this.target == null)
			{
				return;
			}
			if (!this.width.use && !this.height.use)
			{
				return;
			}
			Vector2 sizeDelta = this.target.sizeDelta;
			if (this.width.use)
			{
				sizeDelta.x = this.width.disableSize;
			}
			if (this.height.use)
			{
				sizeDelta.y = this.height.disableSize;
			}
			this.target.sizeDelta = sizeDelta;
		}

		// Token: 0x040022A9 RID: 8873
		[SerializeField]
		private RectTransform target;

		// Token: 0x040022AA RID: 8874
		[SerializeField]
		private ContentSizeChange.SizeInfo width = new ContentSizeChange.SizeInfo();

		// Token: 0x040022AB RID: 8875
		[SerializeField]
		private ContentSizeChange.SizeInfo height = new ContentSizeChange.SizeInfo();

		// Token: 0x02000516 RID: 1302
		[Serializable]
		public class SizeInfo
		{
			// Token: 0x040022AC RID: 8876
			public bool use = true;

			// Token: 0x040022AD RID: 8877
			public float enableSize;

			// Token: 0x040022AE RID: 8878
			public float disableSize;
		}
	}
}
